package net.muchine.core.dao.user;

import java.util.List;

import org.springframework.stereotype.Component;

import net.muchine.core.dao.GenericDaoImpl;
import net.muchine.core.domain.user.Group;
import net.muchine.core.domain.user.GroupUser;
import net.muchine.core.domain.user.User;

@Component
public class GroupUserDaoImpl extends GenericDaoImpl<GroupUser, GroupUser> implements
		GroupUserDao {

	@Override
	public int update(GroupUser entity) {
		throw new UnsupportedOperationException(
				"updating group-user mapping is not allowed. remove adn recreate the mapping.");
	}

	public List<User> selectUsers(Long groupSeq) {
		return this.sqlSession.selectList(this.sqlNamespace + ".selectUsers", groupSeq);
	}

	public List<Group> selectGroups(Long userSeq) {
		return this.sqlSession.selectList(this.sqlNamespace + ".selectGroups", userSeq);
	}
}
